import {login,LoginData} from '../../api/user'

const userStore = {
    namespaced: true,
    state:{
        token:'',
        userInfo:null,
        rulos:null,
        menu:[],
        routes:[]
    },
    getters:{
       token:(state:any)=>state.token,
       userInfo:(state:any)=>state.userInfo,
       rulos:(state:any)=>state.rulos,
       menu:(state:any)=>state.menu,
       routes:(state:any)=>state.routes,
    },
    mutations:{
        SET_TOKEN(state:any,token:string){
            state.token = token
        }
    },
    actions:{
       async login({},user:LoginData){
        console.log('仓库')
            const res = await login(user)
            console.log(res)
        }
    },
}

export default userStore